package org.pz.controller;

import org.pz.entity.UserEntity;
import org.pz.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/info")
public class UserController {

    @Autowired
    private UserService userService;

    /**
    * 根据用户名获取用户信息
    * */
    @RequestMapping("/findUserInfoByUsername")
    public UserEntity findUserInfoByUsername(@RequestParam String username) {
        return userService.findUserEntityByUsername(username);
    }

    /**
     * 判断资源需要哪些角色
     * */
    @RequestMapping("/findRolesByAsset")
    public List<String> findRolesByAsset(@RequestParam String asset){
        return userService.findRolesByAsset(asset);
    }

}

